﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MvcWiki.Model
{
    public class WikiMarkup
    {
        public string Name { get; set; }

        public virtual string Convert(string content)
        {
            return content;
        }

        #region Object

        public override int GetHashCode()
        {
            return Name.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(obj, null))
            {
                return false;
            }

            if (this.GetType() != obj.GetType())
            {
                return false;
            }

            var markup = obj as WikiMarkup;

            return this.Name == markup.Name;
        }

        public static bool operator ==(WikiMarkup wikiMarkup1, WikiMarkup wikiMarkup2)
        {
            if (object.ReferenceEquals(wikiMarkup1, null) && object.ReferenceEquals(wikiMarkup2, null))
            {
                return true;
            }

            if (object.ReferenceEquals(wikiMarkup1, null) || object.ReferenceEquals(wikiMarkup2, null))
            {
                return false;
            }

            return wikiMarkup1.Equals(wikiMarkup2);
        }

        public static bool operator !=(WikiMarkup wikiMarkup1, WikiMarkup wikiMarkup2)
        {
            return !(wikiMarkup1 == wikiMarkup2);
        }

        #endregion
    }
}
